import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
    {
    title: '用户名称',
    align:"center",
    sorter: true,
    dataIndex: 'userName'
   },
   {
    title: '用户年龄',
    align:"center",
    dataIndex: 'userAge'
   },
   {
    title: '用户出生日期',
    align:"center",
    sorter: true,
    dataIndex: 'userBirthday',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '用户性别',
    align:"center",
    dataIndex: 'userSex_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '用户名称',
    field: 'userName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入用户名称!'},
          ];
     },
  },
  {
    label: '用户密码',
    field: 'userPassword',
    component: 'InputPassword',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入用户密码!'},
          ];
     },
  },
  {
    label: '用户年龄',
    field: 'userAge',
    component: 'InputNumber',
  },
  {
    label: '用户出生日期',
    field: 'userBirthday',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入用户出生日期!'},
          ];
     },
  },
  {
    label: '用户性别',
    field: 'userSex',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"sex"
     }
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入用户性别!'},
          ];
     },
  },
];
